$(function(){	
	var detailId=queryString('id');//取得？后的值	
	
	getRecord(detailId);
	setTimeout(function(){
		addRecord(detailId);
	},100)
	function addRecord(detailId){
		YuXi.util.post("addBorwseRec.do",{id:detailId},function(data){
				
		});
	}
	
	
	function getRecord(id){		
		
		YuXi.util.get("getBorecord.do",{id:id},function(data){			
			if(data.status){
				var list=data.object;
				if(list.length<1){
					return false;
				}
				$("#record_contaienr ul.list-group").show();
				$("#record_contaienr ul.list-group").find(".banner .badge").html(list.length);
				for(var i=0;i<list.length;i++){					
					var time=YuXi.getTime.get(list[i].createTime);	
					var Str=time+" "+list[i].userName+" 查阅了";
					if(i>5){
						$("#record_contaienr ul.list-group").append("<li style='display:none' class='countMAX list-group-item'>"+Str+"</li>")
					}else{
						$("#record_contaienr ul.list-group").append("<li class='list-group-item'>"+Str+"</li>");
					}
				}
				
				if(list.length>6){
					$("#record_contaienr ul.list-group").append("<li class='list-group-item show-more active text-center btn'>查看更多...</li>");
				}
			}			
		});
	}
	$(document).on("click",".show-more",function(){
		$(".countMAX").toggle();
	});
	//正则取链接传来的数据
	function queryString(key)
	{
	    var regex_str = "^.+\\?.*?\\b"+ key +"=(.*?)(?:(?=&)|$|#)"
	    var regex = new RegExp(regex_str,"i");
	    var url = window.location.toString();
	    if(regex.test(url)) return RegExp.$1;
	    return undefined;
	}

})

